<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport"
          content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width,height=device-height"/>
    <title>志愿者打卡器</title>

    <!--<link rel="stylesheet" href="lib/dx/16.1.4/css/dx.common.css">
    <link rel="stylesheet" href="lib/dx/16.1.4/css/dx.light.css">-->

    <link rel="stylesheet" href="dist/css/app-7d4056714e.css">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>

    <script src="//cdn.bootcss.com/jszip/3.0.0/jszip.min.js"></script>
    <script type="text/javascript">
        window.zhuge = window.zhuge || [];
        window.zhuge.methods = "_init debug identify track trackLink trackForm page".split(" ");
        window.zhuge.factory = function(b) {
            return function() {
                var a = Array.prototype.slice.call(arguments);
                a.unshift(b);
                window.zhuge.push(a);
                return window.zhuge;
            }
        };
        for (var i = 0; i < window.zhuge.methods.length; i++) {
            var key = window.zhuge.methods[i];
            window.zhuge[key] = window.zhuge.factory(key);
        }
        window.zhuge.load = function(b, x) {
            if (!document.getElementById("zhuge-js")) {
                var a = document.createElement("script");
                var verDate = new Date();
                var verStr = verDate.getFullYear().toString()
                        + verDate.getMonth().toString() + verDate.getDate().toString();

                a.type = "text/javascript";
                a.id = "zhuge-js";
                a.async = !0;
                a.src = (location.protocol == 'http:' ? "http://sdk.zhugeio.com/zhuge.min.js?v=" : 'https://zgsdk.zhugeio.com/zhuge.min.js?v=') + verStr;
                var c = document.getElementsByTagName("script")[0];
                c.parentNode.insertBefore(a, c);
                window.zhuge._init(b, x)
            }
        };
        window.zhuge.load('6b3c569f042040f5bf32285acb975ac3');
    </script>
</head>
<body>
    <div class="nomanager" style="display: none;">
        <div class="nomsg">
            <i class="iconfont icon-nomsg"></i>
            <span>对不起亲</span>
        </div>
        <p>你不是组织管理员，不能参加本次活动。赶紧通知你的管理员 <a>领取组织建设费</a>吧 </p>
    </div>
</body>
<script src="libs/qrcode/qrcode.min.js"></script>
<script type="text/javascript">
    //获取url中的参数
    function GetQueryString(name) {//截取字符串？ &
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) {
            return unescape(r[2]);
        } else {
            return null;
        }
    }
    if(!GetQueryString("memberId")){
        alert('您还未登录，请登录后继续操作')
    }else{
        var memberId = GetQueryString("memberId");
        var inviteCode = "";
        $(function () {
                    $.ajax({
                        url: "/spreadInsurance/checkUser",
                        type: 'post',
                        dataType: 'json',
                        contentType: 'application/json; charset=utf-8',
                        data: JSON.stringify({"memberId": memberId}),
                        error: function () {
                        }, //错误执行方法
                        success: function (data) {
                            // console.log(datas["obj"])
                            if (data["code"] == 0) {
                                var member = JSON.stringify(data.data.member);
                                var flag = data.data.flag;//判断管理员
                                var inviteCode = data.data.inviteCode;//激活码
                                window.sessionStorage.setItem("member", member);
                                if (flag) {
                                    if (inviteCode != "") {
                                        window.location.href = "message.html?inviteCode=" + inviteCode;
                                    } else {
                                        window.location.href = "agreement.html";
                                    }
                                } else {
                                    $(".nomanager").css({"display": "block"});
                                }
                            } else {
                                alert(data.message);
                            }
                        }//成功执行方法
                    })
                }
        )
    }

</script>
</html>
